/*用来获取当前时间*/
#include"head.h"
char* get_time(int type)
{
	time_t timep;
	static struct tm *tm_p = NULL;
	time(&timep);
	tm_p = localtime(&timep);
	
	static char now_time[20] = {};

	if(0 == type)
	{
		snprintf(now_time, 2, " ");
	}
	else if(1 == type)
	{
		snprintf(now_time, 20, "%04d-%02d-%02d", (1900 + tm_p->tm_year), (1 + tm_p->tm_mon), tm_p->tm_mday);
	}
	else if(2 == type)
	{
		snprintf(now_time, 20, "%04d-%02d-%02d %02d:%02d:%02d",(1900 + tm_p->tm_year), (1 + tm_p->tm_mon), tm_p->tm_mday, 
			tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec);
	}
	else if(3 == type)
	{
		snprintf(now_time, 20, "%04d-%02d-%02d_%02d:%02d:%02d", (1900 + tm_p->tm_year), (1 + tm_p->tm_mon), 
			tm_p->tm_mday, tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec);
	}
	else
	{
	}
	
	return now_time;
}
